#include <stdio.h>
void main()
{
    int i,x,y,last=1;
    printf("输入数x和次方y:");
    scanf("%d %d",&x,&y);
    for(i=1;i<=y;i++)
        last=last*x%1000;
    printf("次方后最后三位是%d\n",last%1000);
}